package com.tonann.app.service.impl;

import com.tonann.app.domain.AppFaultRead;
import com.tonann.app.mapper.AppFaultReadMapper;
import com.tonann.app.service.IAppFaultReadService;
import com.tonann.common.utils.DateUtils;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 故障处理Service业务层处理
 *
 * @author tonann
 * @date 2022-10-15
 */
@Service
@AllArgsConstructor
public class AppFaultReadServiceImpl implements IAppFaultReadService {
    private final AppFaultReadMapper appFaultReadMapper;


    /**
     * 查询故障处理
     *
     * @param handleId 故障处理主键
     * @return 故障处理
     */
    @Override
    public AppFaultRead selectAppFaultReadByHandleId(Long handleId) {
        return appFaultReadMapper.selectAppFaultReadByHandleId(handleId);
    }

    /**
     * 查询故障处理列表
     *
     * @param appFaultRead 故障处理
     * @return 故障处理
     */
    @Override
    public List<AppFaultRead> selectAppFaultReadList(AppFaultRead appFaultRead) {
        return appFaultReadMapper.selectAppFaultReadList(appFaultRead);
    }

    /**
     * 新增故障处理
     *
     * @param appFaultRead 故障处理
     * @return 结果
     */
    @Override
    public int insertAppFaultRead(AppFaultRead appFaultRead) {
        appFaultRead.setCreateTime(DateUtils.getNowDate());
        return appFaultReadMapper.insertAppFaultRead(appFaultRead);
    }

    /**
     * 修改故障处理
     *
     * @param appFaultRead 故障处理
     * @return 结果
     */
    @Override
    public int updateAppFaultRead(AppFaultRead appFaultRead) {
        appFaultRead.setUpdateTime(DateUtils.getNowDate());
        return appFaultReadMapper.updateAppFaultRead(appFaultRead);
    }

    /**
     * 批量删除故障处理
     *
     * @param handleIds 需要删除的故障处理主键
     * @return 结果
     */
    @Override
    public int deleteAppFaultReadByHandleIds(Long[] handleIds) {
        return appFaultReadMapper.deleteAppFaultReadByHandleIds(handleIds);
    }

    /**
     * 删除故障处理信息
     *
     * @param handleId 故障处理主键
     * @return 结果
     */
    @Override
    public int deleteAppFaultReadByHandleId(Long handleId) {
        return appFaultReadMapper.deleteAppFaultReadByHandleId(handleId);
    }

}
